home *** CD-ROM | disk | FTP | other *** search
- Path: rahul.net!a2i!news
- From: terris@rahul.net (Terris Linenbach)
- Newsgroups: comp.lang.c++
- Subject: *Fixed* Serious trouble with STL and NT/Win95
- Date: 16 Feb 1996 08:26:28 GMT
- Organization: a2i network
- Message-ID: <4g1f3k$adq@hustle.rahul.net>
- References: <4frrve$pnr@hustle.rahul.net>
- NNTP-Posting-Host: 534.rahul.net
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.6
-
- I eliminated all of the statics.
-
- Keep an eye on
-
- HTTP: www.rahul.net/terris/
-
- For a new thread-safe, DLL-friendly version of HP's STL. It will be there in
- a few days. You will still have to put critical sections around code that
- uses the same object in different threads.
-
- Please let me know of any bugs you may find.
-
- There's no such thing as a free lunch: taking away the statics means memory
- isn't managed as efficiently. Time and space penalties. I will leave the
- previous version of the STL on my FTP site.
-
- If you are going to do serious work with the STL I recommend you buy it from a
- vendor. Rogue Wave will have a version that works with 32-bit MFC in April.
- (It's sold separately from TOOLS.H++.)
-
- - Terris
-
-
- In article <4frrve$pnr@hustle.rahul.net>, terris@rahul.netc says...
- >
- >The following applies to HP's STL implementation, including the version
- >shipped in Microsoft Visual C++ 4.0. Credit goes to David
- >Williams.
- >
- >1. It is not thread-safe. Do not attempt to perform
- > something on the same "type" of container in two different threads
- > at the same time. (You are in trouble even if you try to do this with
- > _different_ objects -- notice I said "type" and not "object")
- >
- > By "type", I mean a particular instantiation, such as
- > vector< int >
- >
- > This is because most STL classes have statics in them that are not
- > accessed in a thread-safe manner.
- >
- >2. Do not pass *most* STL containers across DLL/EXE boundaries. Vectors
- > are OK.
- >
- > This is because most STL classes have statics. In 32-bit
- > Windows, DLLs and EXEs get their own copies of the statics. This
- > causes problems.
- >
- > Vectors are not affected because vectors only have a static allocator,
- > which doesn't have any data or any virtual member functions.
- >
- > If you try something like passing a set to a function in a
- > DLL, your program will crash.
- >
-
-